package com.dnndo.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dnndo.common.core.domain.entity.SysUser;
import com.dnndo.system.domain.Opus;
import com.dnndo.system.domain.SchBrandRoom;
import com.dnndo.system.domain.dto.OpusDTO;
import com.dnndo.system.domain.dto.SchBrandRoomDTO;
import com.dnndo.system.domain.dto.SchoolDTO;
import com.dnndo.system.domain.dto.SysUserDTO;
import com.dnndo.system.mapper.OpusMapper;
import com.dnndo.system.mapper.SchBrandRoomMapper;
import com.dnndo.system.mapper.SchoolMapper;
import com.dnndo.system.mapper.SysUserMapper;
import com.dnndo.system.service.ISchBrandRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SchBrandRoomServiceImpl extends ServiceImpl<SchBrandRoomMapper,SchBrandRoomDTO> implements ISchBrandRoomService {


  private final SchBrandRoomMapper schBrandRoomMapper;
  private final SchoolMapper schoolMapper;

  private final OpusMapper opusMapper;
  private final SysUserMapper  sysUserMapper;

  @Autowired
  public SchBrandRoomServiceImpl(SchBrandRoomMapper schBrandRoomMapper, SchoolMapper schoolMapper, OpusMapper opusMapper, SysUserMapper sysUserMapper) {
    this.schBrandRoomMapper = schBrandRoomMapper;
    this.schoolMapper = schoolMapper;
    this.opusMapper = opusMapper;
    this.sysUserMapper = sysUserMapper;
  }

  @Override
  public SchBrandRoom getschBrandRoom(Integer id) {
    SchBrandRoom schBrandRoom = new SchBrandRoom();
    //根据id获取学校信息
    SchoolDTO schoolDTO = schoolMapper.selectSchoolListById(Long.valueOf(id));
    System.out.println("schoolDTO = " + schoolDTO.toString());
    //从大赛表中获取对应学校id的文创校徽和文创周边
    OpusDTO dto = new OpusDTO();
    dto.setSchoolId(id);
    List<Opus> opusesList = opusMapper.selectOpusList(dto);
    //todo:从用户表中获取绑定了改学校id，并且是校园大使的用户列表
    SysUserDTO userDTO = new SysUserDTO();
    //userDTO.setSchoolId(id);
    //userDTO.setrank(id);
    List<SysUser> userList = sysUserMapper.selectUserList(userDTO);
    //todo:从作品表中查询这些大使的作品

    return  schBrandRoom;
  }
}
